$(document).ready(function() {
	var tag = 1; //可以点击转动
	

	$('.click_img').rotate({
		bind: {
			click: function() {
				if (tag == 1) {
					$.ajax({
							url: lucky_url,
							type: 'GET',
							success: function(data) {
							
								
								var data = JSON.parse(data)
								console.log(data)
								if (data.code == 1) {
									tag = 0; //不可以转动
									var num = data.data.pointer_location;
									var ang = data.data.pointer_location * 45
									console.log(ang)
									console.log(data.data)

									$('.lucky_img').rotate({
										angle: 0,
										duration: 5000,
										animateTo: 3600 - ang,
										easing: $.easing.easeInOutExpo,
										callback: function(){
											tag = 1;
											$('.mask ,.close ,.jiangimg').css('display','block');
											$('.jiang_title').html(data.data.title)
											$('#jiangimg').attr('src',''+data.data.hint_img+'')
											$('.npoint_count').html(data.data.npoint_count)
											if (num == 0) {
												
												
												$('.jiangimg').addClass('weizhongjiang')
												$('.jiang_again img').attr('src',''+src+'/images/nshop_lucky_pity_btn.png')
												

												
											}else{
												$('.jiangimg').addClass('yizhongjiang')
												$('.jiang_again img').attr('src',''+src+'/images/nshop_lucky_prize_btn.png')
												
												$('.jiang_again').click(function(event) {
													window.location.href =href
													
												});

											}
											
										}
									});
								}else{
									tag = 1;
									alert(data.desc)
								}


								
							},
							error:function(xhr, textStatus){
								
								if(xhr.status == 401){
									alert(11);
									 window.location.href = "/Npoint_store/Login";
									 
								}else{
									alert('系统错误')
								}

							}
						})
						// setTimeout(function () {
						//     $(".lucky_img").stopRotate();
						// }, 2500);
				}
			}
		}
	});


	$('.close ,.jiang_again').click(function(event) {
		$('.mask ,.close ,.jiangimg').css('display','none')
	});



	// 初始化规格参数
	$('.detail_select_xh li:first').addClass('cur');
	// 关闭
	$('.detail_select_close').click(function(event) {
		$('.detail_select').hide();
		$('.detail_mask').hide();
	});

	$('.detail_select_xh li').click(function(event) {
		$(this).addClass('cur').siblings().removeClass('cur');
		$('.detail_select_xinghao').html($(this).html())
		// attr_id = $(this).attr('data-c')
		// kuc()
	});




});